package com.aaa.forum.dao;

import com.aaa.forum.model.ArticleLike;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

@Mapper
public interface ArticleLikeMapper {
    int insert(ArticleLike row);

    int insertSelective(ArticleLike row);

    ArticleLike selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(ArticleLike row);

    int updateByPrimaryKey(ArticleLike row);

    /**
     * 根据 用户id 和 帖子id 查询点赞记录
     * @param userId        用户id
     * @param articleId     帖子id
     * @return              点赞记录
     */
    ArticleLike selectByUserIdAndArticleId(@Param("userId") Long userId, @Param("articleId") Long articleId);

    /**
     * 获取点赞状态
     * @param userId        用户id
     * @param articleId     帖子id
     */
    Byte getState(@Param("userId") Long userId, @Param("articleId") Long articleId);
}